package ex5.enclass;

/**
 * @author: knowno
 * @create: 2024-09-06 15:22
 * @Version 1.0
 **/
public class TestInteger {
    public static void main(String[] args) {

        System.out.println("Integer常量池--- -128~127范围内的数据才会缓存 常量池");
        Integer i1 = 12;
        Integer i2 = 12;
        System.out.println(i1 == i2);

        //这里的1234超出了-128~127的范围，不会使用常量池来存储. 地址不同
        Integer i3 = 1234;
        Integer i4 = 1234;
        System.out.println(i3 == i4);

        //Double
        double d1 = 3.121212121;
        double d2 = 3.121212122;
        // == ?
//        Double
        int compare = Double.compare(d1, d2);
        System.out.println(compare);

//        public int compareTo(Double anotherDouble) {
//            return Double.compare(value, anotherDouble.value);
//        }

    }
}
